Grey Calendar
CalVBX

Properties	Event's	  	Run Demonstration

Description

The CalVBX  is a calendar vbx designed for use with Visual Basic. When you create a CalVBX in the design environment the date is initially set to todays date and appears as a 3D fixed size calendar.

CalVBX  is fully configurable apart from its size which remains fixed appropriate to the size of the fontsize selected. However the actual font used is configurable.

Use

Once the calendar has been incorporated into a program and run, clicking on the dates will change the displayed date and the value of NewDate (type string). This can be used to supply a date for another use by adding code to the OnChange event.

Clicking on the chevrons will either advance or  reduce the selected month by one. If the selected date exceeds the number of days in the newly selected month the day will revert to the last day of the month.


Properties
Properties in addition to standard properties.

BorderStyle              CalDate

 DateText                  HighlightColour

HighlightText          SatColour

StartofWeek           SunColour


BorderStyle
BorderStyle default Raised (0)

See also

The BorderStyle property is available at both design and at runtime, and allows the user to select from :

                               Raised	0

                               Inset	1

                               Normal	2

                               None	3

giving a 3D effect or not etc.

Example

This example toggles the BorderStyle in the calendar through all values.

Sub Command7_Click ()

    Static x As Integer

    x = x + 1                                       'increase x by 1

    If x = 4 Then x = 0                     'maximum border style is 3

    Calendar1.BorderStyle = x  'change border style to value of x

End Sub


CalDate

See also

The CalDate property is only available at runtime, and allows the date selected  to be changed from within a programs code.

Important:

The Date must be between 1st Jan 1970 and 31st Dec 2037. Using dates before or after these will result in the date reverting to either of these dates.

Example

This example sets the date to my birthday.

Sub Command4_Click ()

   Calendar1.CalDate = CVDate("17/10/1995")

End Sub


DateText
DateText default Black

See also

The DateText property is available at both design and at runtime, and allows the colour used to display the selected date at the top of the calendar to be customized.

Example

This example toggles the displayed colour  between Red and Blue.

Sub Command5_Click ()

    If Calendar1.DateText = RGB(255, 0, 0) Then

        Calendar1.DateText = RGB(0, 0,  255)

    Else

        Calendar1.DateText = RGB(255, 0, 0)

    End If

End Sub


HighlightColour
HighlightColour default Blue

See also

The HighlightColour property is available at both design and at runtime, and allows the background colour of the selected date to be customized.

Example

This example changes the background colour to Red.

Sub Command1_Click ()

    Calendar1.HighlightColour  = RGB(255, 0, 0)

End Sub


HighlightText
HighlightText default Black

See also

The HighlightText property is available at both design and at runtime, and allows the text colour of the selected date to be customized.

Example

This example changes the text colour to White.

Sub Command1_Click ()

    Calendar1.HighlightText  = RGB(255, 255, 255)

End Sub


SatColour
SatColour default Black

See also

The SatColour property is available at both design and at runtime, and allows the colour used to display Saturday's to be customized.

Example

This example toggles the displayed colour for Saturday's during the month, between Green and Black in the calendar.

Sub Command5_Click ()

    If Calendar1.SatColour = RGB(0, 0, 0) Then

        Calendar1.SatColour = RGB(0, 255, 0)

    Else

        Calendar1.SatColour = RGB(0, 0, 0)

    End If

End Sub


StartOfWeek
StartOfWeek  default 0 {Monday}

See also

The StartOfWeek property is available at both design and at runtime, and allows the first day shown on the calendar to be customized by changing the integer value. With Monday = 0 through to Sunday = 6.

Example

This example cycles through the day's of the week and set the start of the week.

Sub Command8_Click ()

    Static x As Integer

    x = x + 1                                       'increase x by 1

    If x = 7 Then x = 0                     'maximum value is 6

    Calendar1.StartofWeek = x  'change StartofWeek to value of x

End Sub


SunColour
SunColour default Blue

See also

The SunColour property is available at both design and at runtime, and allows the colour used to display Sunday's to be customized.

Example

This example toggles the displayed colour for Saturday's during the month, between Red and Blue in the calendar.

Sub Command1_Click ()

    If Calendar1.SunColour = RGB(255, 0, 0) Then

        Calendar1.SunColour = RGB(0, 0,  255)

    Else

        Calendar1.SunColour = RGB(255, 0, 0)

    End If


Events
Events in addition to standard events

OnChange


OnChange

Declaration

Sub Calendar1_OnChange (NewDate As String)

The OnChange event occurs when the date  in  CalVBX  is modified. For example, OnChange occurs when the  user clicks on the Calendar, or when the property CalDate is changed by code.

Example.

The date in the Label Control in this example changes each time the user clicks on a date in the Calendar:

Sub Calendar1_OnChange (NewDate As String)

     'When user clicks to change date changes the text in label1.

     Label1 = Format(NewDate, "Long Date")

End Sub


Next
Clicking here goes to the next month.


Main
Clicking here changes the day.


Prev
Clicking here goes to the previous month.


CalVBX

Thank you for your interest. CalVBX was written by Graham Winter and can be registered either by;

Option 1   GO SWREG ON CompuServe.  	Price: £5.00

On CompuServe 'GO SWREG' and register shareware Filename CalVBX.zip .  This results in CompuServe charging your account £5.00 and CompuServe then notifies me that the VBX has been registered. I will then send you the latest unrestricted version.

Option 2

Sending a cheque for £7.50 to:

Mr. G M Winter

44 Southfield Road

Pocklington

York YO4 2XE.

England.

I will then send you the latest unrestricted version by post.

I can be contacted on CompuServe ID 100025,1056 if you have any problems, questions or anything else.

Should you require the source code (written in C) then Please send a cheque for £20.00.